package tests;

import java.util.ArrayList;
import java.util.List;

import junit.framework.TestCase;

import com.qsi.app.golf.model.Golfer;
import com.qsi.app.golf.model.GolfManager;

public class TestGolfManager extends TestCase {

    private GolfManager manager;

    public void setUp() {
    	manager = new GolfManager();
    	Golfer golfer1 = new Golfer();
    	Golfer golfer2 = new Golfer();
    	golfer1.setFirstName("Ed");
    	golfer1.setLastName("LeGault");
    	golfer2.setFirstName("Todd");
    	golfer2.setLastName("Kaufman");
    	List golfers = new ArrayList();
    	golfers.add(golfer1);
    	golfers.add(golfer2);
        MockGolfDAOImpl mockDao = new MockGolfDAOImpl();
        mockDao.setGolfers(golfers);
        manager.setGolfDAO(mockDao);
    }

    public void testGetGolfers() {
        List golfers = manager.getGolfers();
        Golfer golfer1 = (Golfer)golfers.get(0);
        Golfer golfer2 = (Golfer)golfers.get(1);
        assertEquals("LeGault", golfer1.getLastName());
        assertEquals("Kaufman", golfer2.getLastName());
    }

    public void testCreateGolfer() {
        Golfer golfer = new Golfer();
    	manager.createGolfer(golfer);
    }

}